package top.buluoluo.productservice.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.buluoluo.commoncore.domain.response.Result;
import top.buluoluo.productservice.dto.response.BrandDTO;
import top.buluoluo.productservice.dto.response.CategoryTreeDTO;
import top.buluoluo.productservice.service.ProductService;

import java.util.List;

@RestController
@RequestMapping("/brand")
@Tag(name = "商品品牌管理", description = "商品品牌管理接口")
public class BrandController {
    @Autowired
    private ProductService productService;
    @Operation(summary = "获取对应商品种类关联的品牌接口", description = "根据传入的商品种类id递归商品种类树查询所有关联的品牌")
    @GetMapping("/getAllBrands/{categoryId}")
    public Result<List<BrandDTO>> getAllBrands(@PathVariable Long categoryId) {
        return productService.getBrandsByCategoryId(categoryId);
    }
}
